//
//  UIView+TP_Utility.h
//  E_Car
//
//  Created by 谭鹏 on 2017/4/12.
//  Copyright © 2017年 谭鹏. All rights reserved.
//

#import <UIKit/UIKit.h>
typedef void(^WillAnimatedHandle)();
typedef void(^AnimationsHandle)();
typedef void(^DidAnimatedHandle)();
static NSInteger kViewTag_spaceView = 101;
@interface UIView (TP_Utility)

//批量添加子试图
-(void)addSubviews:(NSArray <UIView *> *)views;
//只搜索对应tag的子视图
-(UIView *)subViewWithTag:(NSInteger)tag;




#pragma mark - get super view controller
-(UIViewController *)getSuperViewController;
-(UIView *)getSuperViewWithClass:(Class)class;

-(void)setBlankBackgroundViewHiden:(BOOL)hiden;
//动画
#pragma mark - animation
-(void)animatedWithScale:(CGFloat)scale willAnimatedHandle:(WillAnimatedHandle)willAnimatedHandle animationsHandle:(AnimationsHandle)animationsHandle didAnimatedHandleid:(DidAnimatedHandle)didAnimatedHandle;

-(void)animatedFromeScale:(CGFloat)scale willAnimatedHandle:(WillAnimatedHandle)willAnimatedHandle animationsHandle:(AnimationsHandle)animationsHandle didAnimatedHandleid:(DidAnimatedHandle)didAnimatedHandle;

//约束更新后 产生动画
- (void)animatedWithConstraintsUpdate;

#pragma mark - 规则排列

/**
 * 规则排列childViews
 * 如果childViews为空，则排列自己subViews
 * 会添加childView，如果有childView 和 subView 有重复则不会添加
 */
-(void)setGridConstraintsWithChildViews:(NSArray<UIView *> *)childViews colunm:(NSUInteger)colunm childViewHeight:(CGFloat)childViewHeight childViewWidth:(CGFloat)childViewWidth rowSpace:(CGFloat)rowSpace colunmSpace:(CGFloat)colunmSpace edgeInsets:(UIEdgeInsets)edgeInsets;


#pragma mark - 工厂产生 线
+(UIView *)lineWithWidth:(CGFloat)width bgColor:(UIColor *)bgcolor isHorizonal:(BOOL)isHorizonal ;
@end

